#include <dbg.h>

#include <cassert>
#include <unordered_set>
#include <vector>

using namespace std;

class Solution {
public:
    vector<vector<int>> findDifference(vector<int>& nums1, vector<int>& nums2) {
        vector<vector<int>> res(2);
        unordered_set<int> set1, set2;

        for (int num : nums1) {
            set1.insert(num);
        }
        for (int num : nums2) {
            set2.insert(num);
        }

        for (int num : set1) {
            if (count(nums2.begin(), nums2.end(), num) == 0) {
                res[0].push_back(num);
            }
        }
        for (int num : set2) {
            if (count(nums1.begin(), nums1.end(), num) == 0) {
                res[1].push_back(num);
            }
        }

        return res;
    }
};

int main() {
    Solution s;

    vector<int> nums1{1, 2, 3}, nums2{2, 4, 6};
    vector<int> nums3{1, 2, 3, 3}, nums4{1, 1, 2, 2};

    vector<vector<int>> output1{{1, 3}, {4, 6}};
    vector<vector<int>> output2{{3}, {}};

    assert(s.findDifference(nums1, nums2) == output1);
    assert(s.findDifference(nums3, nums4) == output2);

    return 0;
}